package org.hospital.pojo;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

/**
 * TFurVisit entity. @author MyEclipse Persistence Tools
 */

@Entity
@Table(name="t_fur_visit")
public class TFurVisit implements java.io.Serializable {

	// Fields
	
	private Integer furId;
	//private Integer firId;
	private TFirVisit firVisit;
	private Date furDate;
	private String process;
	private Set<TFurPhoto> furPhoto = new HashSet<TFurPhoto>();

	// Constructors
	
	@OneToMany(mappedBy="furVisit", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
	public Set<TFurPhoto> getFurPhoto() {
		return furPhoto;
	}

	public void setFurPhoto(Set<TFurPhoto> furPhoto) {
		this.furPhoto = furPhoto;
	}
	
	public void addFurPhoto(TFurPhoto furPhoto) {   
        if (!this.furPhoto.contains(furPhoto)) {   
            this.furPhoto.add(furPhoto);   
            furPhoto.setFurVisit(this);   
        }   
    }   
  
    public void removeFurPhoto(TFurPhoto furPhoto) {   
    	furPhoto.setFurVisit(null);   
        this.furPhoto.remove(furPhoto);   
    }
    
    @ManyToOne(cascade={CascadeType.REFRESH,CascadeType.REMOVE},optional=false) 
	@JoinColumn(name="FIR_ID")
	public TFirVisit getFirVisit() {
		return firVisit;
	}

	public void setFirVisit(TFirVisit firVisit) {
		this.firVisit = firVisit;
	}
	
	/** default constructor */
	public TFurVisit() {
	}

	/** full constructor */
	public TFurVisit(Date furDate, String process) {
		this.furDate = furDate;
		this.process = process;
	}

	// Property accessors
	@Id
	@Column(name="FUR_ID",insertable=true,nullable=false,updatable=true)
    @GeneratedValue(strategy=GenerationType.AUTO)
	public Integer getFurId() {
		return this.furId;
	}

	public void setFurId(Integer furId) {
		this.furId = furId;
	}

//	public Integer getFirId() {
//		return this.firId;
//	}
//
//	public void setFirId(Integer firId) {
//		this.firId = firId;
//	}

	@Column(name="FUR_DATE")
	public Date getFurDate() {
		return this.furDate;
	}

	public void setFurDate(Date furDate) {
		this.furDate = furDate;
	}

	public String getProcess() {
		return this.process;
	}

	public void setProcess(String process) {
		this.process = process;
	}

}